VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "ClsComision"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

'Clase Comision
Public WithEvents orset As ClsRecordset
Attribute orset.VB_VarHelpID = -1

Public Event DataChanged()

'Miembros de la Clase
Public codDocumento As String
Public codComisionista As String
Public fecha As String
Public monto As Double
Public cobrado As Boolean

' Constructor y Destructor
Private Sub Class_Initialize()
    Set orset = New ClsRecordset
    orset.setCampos dbCampos(cms)
    orset.setTablas Array(cms)
End Sub
Private Sub Class_Terminate()
    Set orset = Nothing
End Sub
' Generic Data management methods
Public Sub consulta()
    orset.consulta
End Sub
Public Sub consultaXDocumento(documentoCod As String)
    orset.consulta Array(cms_doc_id & "='" & documentoCod & "'")
End Sub
'Public Sub consultaDatos(codig As String)
'    orset.consulta Array(cms_id & "=" & codig)
'    orset.CierraRec
'End Sub
Private Sub Reload_members()
    With orset
        codDocumento = .getDato(cms_doc_id)
        codComisionista = .getDato(cms_com_id)
        fecha = .getDato(cms_fecha)
        monto = .getDato(cms_monto)
        cobrado = .getDato(cms_cobrado)
    End With
    RaiseEvent DataChanged
End Sub

Public Sub Nuevo(newDocId As String, newComId As String, newFecha As String, newMonto As String, newCobrado As String)
    orset.sInsertGral dbCampos(cms), _
                      Array(newDocId, newComId, newMonto, newCobrado), _
                      Array(cms), False, True
End Sub
Public Sub Modificar(newDocId As String, newComId As String, newFecha As String, newMonto As String, newCobrado As String)
    'TODO: ver si es necesaria una llave primaria
    orset.sUpdateGral dbCampos(cms), _
                      Array(newDocId, newComId, newFecha, newMonto, newCobrado), _
                      Array(cms), _
                      Array(cms_doc_id & "='" & newDocId & "'", _
                            cms_com_id & "='" & newComId & "'"), False
End Sub
Public Sub Borrar(DocId As String)
    orset.sDeleteGral Array(cms), Array(cms_doc_id & "=" & doc_id)
End Sub
Private Sub orset_DataChanged()
    Reload_members
End Sub
